package com.dongrj.framework.starter.log.config;

import com.dongrj.framework.starter.log.constant.LogConstant;
import com.dongrj.framework.starter.log.filter.LogMDCServletFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

/**
 * @author dongrongjun
 * @date 2020/08/04
 */
public class FilterConfig {

    @Bean
    public FilterRegistrationBean<LogMDCServletFilter> logMdcFilter() {
        FilterRegistrationBean<LogMDCServletFilter> registration = new FilterRegistrationBean<>();
        registration.setFilter(new LogMDCServletFilter());
        registration.addUrlPatterns("/*");
        registration.setName(LogConstant.LOG_FILTER);
        registration.setOrder(1);
        return registration;
    }
}
